package com.mpspboot.util;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

/**
 * 自定义分页结果
 * @author GuoChunbo
 * @create 2021-02-22 9:31
 * @Description: 类的描述
 */
public class PageInfo<T> extends Page<T> {

    public PageInfo() {
    }

    public PageInfo(long current, long size) {
        super(current, size);
    }


    //提供总页数方法
    public long getPages() {
        if (this.getSize() == 0L) {
            return 0L;
        } else {
            long pages = this.getTotal() / this.getSize();
            if (this.getTotal() % this.getSize() != 0L) {
                ++pages;
            }

            return pages;
        }
    }
}
